package cn.maiyar.email.config;

import cn.maiyar.email.MailProperties;
import cn.maiyar.email.feign.IEmailClient;
import cn.maiyar.email.service.MailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

/**
 * 邮件配置文件
 *
 * @author c.c
 **/
@Slf4j
@EnableConfigurationProperties(MailProperties.class)
@ConditionalOnProperty(prefix = "meta.email" , name = "enabled" , havingValue = "true")
public class EmailConfig {

    @Bean
    public IEmailClient emailHttpClient() {
        log.debug("初始化 IEmailClient!");
        return new MailService();
    }
}
